home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq21.zip
/
MBBS.SLT
< prev
next >
Wrap
Text File
|
1992-03-20
|
12KB
|
336 lines
//-----------------------------------------------------------
// MBBS.SL? Automatic logging into an MBBS system.
//
// Please look at the comments through the whole file, and modify to
// suit your needs, BEFORE you use it. Then recompile with CS MBBS.
//-----------------------------------------------------------
// If you have suggestions for improving this script, please suggest
// improvements to me via old-fashioned snail-mail to:
// Author: Inge Vabekk
// Hamangskogen 108
// N-1300 SANDVIKA
// NORWAY
// tel. (472) 546 396
str thisBBStype[] = "MBBS" // This BBS type.
,line [80] // General help line.
,codename [8] // Code name for this BBS.
,myprot [2] // Chosen protocol.
,hisprot [2] // MBBS's translation.
,mypass [24] // My password
// For the Global storage:
,global []="GLOBAL" // Global script.
,PutLine []="PUTLINE" // PutLine script
,bbstype []="BTYPE" // BBS type
,short []="SHORT" // Short BBS name
,code []="CNAME" // Code name for this BBS
,hprot []="HPROT" // MBBS's interpretation of protocol
,prompt []="PROMPT" // Current prompt (global name)
,mscript []="MDOOR" // Name of mail door
,passw []="PASSW" // Current password
,mailup []="MAILUP" // Name of upload mail script
,command[10] // Current prompt (value)
;
int y=4 // Y coordinate for messages
,tol = 300 // No activity for 30 seconds
,t1, t2, t3, t4, t5, t6, t7 // makes script time out.
,pw1 // Tracks new password request
,stat, tmark
,messages // Messages to fetch?
,fixup='0' // '1' if setup should be fixed
,Enter = 13
;
//-----------------------------------------------------------
// Script starts here.
//-----------------------------------------------------------
main(int ppass)
{
int filter
,i, j, k, l
,mo
,dlfile
,status
;
entry(); // Updates colors & status bar.
// Only if online.
if (!carrier())
{ failtone();
status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
return (-1);
}
read (bbstype,line); // Get current BBS type.
if (line != thisBBStype)
{ wrongBBS(); // Doesn't match script!
return (-1);
}
// Start tracking.
status = 1;
t1 = track ("Command:",0); // Track command.
t2 = track ("Kommando",0); // Norwegian.
t3 = track ("? for menu)",0); // Command (non-expert)
t4 = track ("Status:",0); // System status.
mo = track ("--more--", 0);
pw1 = track ("will echo)",0); // Password not accepted?
read (passw,mypass);
if (ppass) // Write password?
{ cputs (mypass); // Can't use PutLine here!
cputc (Enter);
delay(1);
cputs ("^K"); // Cut some of the crap.
}
tmark = timer_start (tol); // Wait a minute for login
while ((stat=trig()) > 0) // Check for files to download.
{ if (stat == t1) // Command?
break; // So proceed.
else if (stat == t2) // Norwegian command???
english(); // Redefine to English.
else if (stat == t3) // Non-expert?
{ call (PutLine, "U X S", Enter); // Tell him I'm a SuperExpert!
track_free(stat); // Release this tracking.
}
else if (stat == t4) // System status?
status = 0;
else if (stat == pw1) // New password request?
{ cputs (mypass); // Send password. Remember we
cputc (Enter); // can't use PutLine here!!!!
}
else if (stat == mo) // MORE? Just stop this for now.
call (PutLine, "N", Enter);
}
release(); // Release tracks and timer.
if (!carrier()) return (-1);
terminal(); // Update screen.
i = j = gety(); // All lines on screen:
while (i >= 0)
{ vgetchrs(0,--i,line,0,60); // Get the line.
setchr (line,60,0);
if (strposi(line,"private file(s)",0) > 0)
{ read (short,line); // Get short BBS name.
strcat (line,".DL"); // Add DL extension.
dlfile = fopen (line,"a"); // Try open <BBS>.DL
for (++i; i<j; ++i)
{ vgetchrs(0,i,line,0,60); // Get the filename.
setchr (line,60,0); // Write three lines
if (trim(line) <= 0) break; // Return if line empty.
fputs (line,dlfile); // Write line to file.
fputs ("^M^J",dlfile);
}
fclose(dlfile); // Close .dl file.
i = -1; // Done.
}
}
line = "CHAT N;"; // No chat.
if (status) strcat (line,"W;"); // Who's on?
strcat (line,"U L 0;T "); // Continuous output.
read (hprot,hisprot); // Make sure protocol is
strcat (line,hisprot); // whatever defined in
call (PutLine, line, Enter); // the phone directory. Get
// list of who's on.
command = "Command:"; // Set MBBS command prompt.
write (prompt,command);
t1 = track (command,0); // Use it for tracking.
t2 = track ("lter enabl",0); // Filter still enabled?
t3 = track ("lter disab",0); // Filter disabled?
tmark = timer_start (tol); // Give me a minute.
filter = 1;
while ((stat=trig()) > 0) // Until filter is off:
{ if (stat==t1) // Command:
{ if (!filter) break; // Filter off?
flush();
cputc (222); // Write an ASCII 222 to the port.
filter=cgetct(3)!=222; // Did it return unchanged?
cputc (8); // Delete the ASCII 222 w/ backspace.
if (!filter) break; // Filter off now?
call (PutLine, "FILT", Enter); // No, switch it off.
}
else if (stat == t2)
filter = 1; // Filter still on!
else if (stat == t3)
break; // No, it's off!
}
release(); // Release tracks and timer.
if (!carrier()) return (-1);
write (mscript,mailup); // Next script.
read (fixup,line); // Fix setup?
if (subchr(line,0)=='1')
{ cputs("M Y Y Y Y N Y;MF 40;AF Z;C^M");
t1 = track("ll be", 0);
t2 = track(command, 0);
tmark = timer_start (tol); // Give me a minute.
while ((stat=trig()) > 0) // Until conference list is set:
{ if (stat == t1)
call (PutLine,"C",Enter);
else if (stat == t2)
break;
}
release();
}
if (!carrier()) return (-1);
vgetchrs(0,gety(),line,0,80); // Get last line on screen.
if (strpos (line,command,0) < 0) // If it isn't a prompt,
waitfor (command,5); // wait.
return (0); // Return.
}
//-----------------------------------------------------------
// Wrong BBS type.
//-----------------------------------------------------------
wrongBBS()
{
str help[48];
failtone(); // Alarm.
help = "This script is for "; // Catenate strings.
strcat (help,thisBBStype);
strcat (help," only!");
status_wind (help,20); // Display message for 2 sec.
}
//-----------------------------